int inByte = 0; // for incoming serial data
int lockStatement = 0; // locked statement
int door = 11;
int checkstate = 0;
int doorState;

void setup() {
  pinMode(9,OUTPUT);
  pinMode(10,OUTPUT);
  pinMode(11,INPUT);
  Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}
void loop() {
  // send data only when you receive data:
  checkstate = digitalRead(door);
  if(checkstate == 1){ 
    if (Serial.available() > 0) {
    // read the incoming byte:
    inByte = Serial.read();
    // say what you got:
    
    Serial.print("Press button: ");
    Serial.println(inByte, DEC);
    switch (doorState){
        case 0 : {
          digitalWrite(9, LOW);
          if(inByte == 'L'){
            digitalWrite(10, HIGH);
            delay(1000);
            digitalWrite(10, LOW);
            doorState = 1;
          }
        }
        case 1 : { //door LOCK
          digitalWrite(9, HIGH);
          if(inByte == 'U'){
            digitalWrite(10, HIGH);
            delay(1000);
            digitalWrite(10, LOW);
            delay(1000);
            digitalWrite(10, HIGH);
            delay(1000);
            digitalWrite(10, LOW);
          }
        }
      }
    }
  }
}
//    if (inByte == 85){
//      digitalWrite (10, HIGH);
//      delay(90);
//      digitalWrite (10, LOW);
//      delay(90);
//      digitalWrite (10, HIGH);
//      delay(90);
//      digitalWrite (10, LOW);
//      delay(90);
//    }
//    if (incomingByte == 76){
//      digitalWrite (9, HIGH);
//    }
//  }
//}
